<?php
/**
 * Created by PhpStorm.
 * User: ZD-SERVER
 * Date: 2017/8/1
 * Time: 9:51
 */



function sendMail($arr){


    require_once "mySendMail.php";
    $mail = new MySendMail();
// $mail->setServer("smtp@126.com", "XXXXX@126.com", "XXXXX"); //设置smtp服务器，普通连接方式

//    $mail->setServer("smtp.qq.com", "2733934224@qq.com", "npsyxfeettywddic", 465, true); //设置smtp服务器，到服务器的SSL连接
    $mail->setServer("smtp.qq.com", "1966694923@qq.com", "jmvefqjqkxajbija", 465, true); //设置smtp服务器，到服务器的SSL连接
//    $mail->setFrom("2733934224@qq.com"); //设置发件人
    $mail->setFrom("1966694923@qq.com"); //设置发件人
//    $mail->setReceiver("czrll2@163.com"); //设置收件人，多个收件人，调用多次
// $mail->setCc("XXXX"); //设置抄送，多个抄送，调用多次
// $mail->setBcc("XXXXX"); //设置秘密抄送，多个秘密抄送，调用多次
//    $mail->addAttachment("../miku.jpg"); //添加附件，多个附件，调用多次
    $mail->setMail("test", "<b>test</b>"); //设置邮件主题、内容


    if(isset($arr['addAddress'])){
        $addArr=explode(',',$arr['addAddress']);
        foreach ($addArr as $v)
            $mail->setReceiver($v);
    }
    if(isset($arr['Body'])&&isset($arr['Subject']))
        $mail->setMail($arr['Subject'],$arr['Body'].date("Y-m-d H:i:s"));
    if(isset($arr['addAttachment'])){
        $addArr=explode(',',$arr['addAttachment']);
        foreach ($addArr as $v)
            $mail->addAttachment($v);
    }
    $mail->sendMail(); //发送

}